<template>
    <StElUpload
            v-bind="$attrs"
            ref="stelupload"
            :multiple="false"
            :auto-upload="false"
            :show-file-list="true"
            :on-change="onChange">
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div v-if="$attrs.tips" class="el-upload__tip" slot="tip" v-html="$attrs.tips"></div>
    </StElUpload>
</template>

<script>
    export default {
        name: 'StElUploadFileRaw',
        props:{
            value: null
        },
        data() {
            return {
            };
        },
        methods: {
            onChange (file, fileList) {
                this.$emit('input',file)
            },
        },
        watch:{
            value(val) {
                if (!val) {
                    this.$refs.stelupload.getUploadRef().clearFiles()
                }
            }
        }
    }
</script>
